package com.xinqi.modules.exam.paper.manager;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xinqi.common.mybatis.data.service.BaseService;
import com.xinqi.modules.exam.paper.domain.CourseExamPaperEntity;
import com.xinqi.modules.exam.paper.domain.CourseExamPaperStatsEntity;
import com.xinqi.modules.exam.paper.dto.req.CourseExamPaperStatsQueryDTO;
import com.xinqi.modules.exam.paper.dto.rsp.CourseExamPaperStatsDataDTO;
import com.xinqi.modules.exam.paper.dto.rsp.CourseExamPaperStatsResultDTO;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 课程测评统计管理层
 *
 * @author: linkai
 * @date: 2023/07/02
 */
public interface CourseExamPaperStatsManager extends BaseService<CourseExamPaperStatsEntity> {

    /**
     * 自定义分页查询
     */
    Page<CourseExamPaperStatsResultDTO> findPage(Page<Object> page, CourseExamPaperStatsQueryDTO query);

    /**
     * 自定义列表查询
     */
    List<CourseExamPaperStatsResultDTO> findList(CourseExamPaperStatsQueryDTO query);

    /**
     * 根据id查询 课程测评统计数据
     */
    CourseExamPaperStatsEntity findById(Long id);

    CourseExamPaperStatsEntity findByExamId(Long examId);

    /**
     * 根据id删除 课程测评统计数据
     */
    @Transactional(rollbackFor = Exception.class)
    boolean deleteById(Long id);

    @Transactional(rollbackFor = Exception.class)
    void initConfig(CourseExamPaperEntity entity);

    @Transactional(rollbackFor = Exception.class)
    void updateTotalNumById(Long examId, Integer totalNum);

    @Transactional(rollbackFor = Exception.class)
    void updateAddSubmittedNumById(Long examId, Integer num);

    @Transactional(rollbackFor = Exception.class)
    void updateAddApprovedNumById(Long examId, Integer num);

    @Transactional(rollbackFor = Exception.class)
    void initStatsData(Long examId, CourseExamPaperStatsDataDTO stats01);
}
